package us.icitap.commandcenter;

import us.icitap.commandcenter.ui.custom.CustMenuBar;

import com.vaadin.ui.MenuBar;



public class CCMenuBar extends CustMenuBar {
	MenuBar.MenuItem operatorMenu =
			this.addItem("Operator", null, null);
	
	final MenuBar.MenuItem callRegistrationMenu;
	
	final MenuBar.MenuItem dispatcherMenu;
	
	final MenuBar.MenuItem supervisorMenu;
	
	final MenuBar.MenuItem callSituationMenu;
	
	final MenuBar.MenuItem configMenu;   

	final MenuBar.MenuItem confCommandCenterMenu;
	final MenuBar.MenuItem confDispatcherMenu;
	final MenuBar.MenuItem confCallReasonMenu;
	final MenuBar.MenuItem confGradeMenu;
	
	
	
	final CommandCenterUI ui;
	
	public CCMenuBar(CommandCenterUI ui) {
		this.setWidth("100%");
		this.ui = ui;
		
		callRegistrationMenu =
				operatorMenu.addItem("Rregjistrimi i telefonatave", menuCommand);
		
		dispatcherMenu =
				this.addItem("Shperndares", menuCommand);
		
		supervisorMenu =
				this.addItem("Supervizor", null, null);
		
		callSituationMenu =
				supervisorMenu.addItem("Situata e telefonatave", menuCommand);
		
		configMenu = this.addItem("Konfigurimi i te dhenave", null);
		confCommandCenterMenu = configMenu.addItem("Sallat Operative", menuCommand);
		confDispatcherMenu = configMenu.addItem("Shperndaresit", menuCommand);
		confCallReasonMenu = configMenu.addItem("Arsyet e telefonatave", menuCommand);
		
		confGradeMenu = configMenu.addItem("Gradat e telefonatave", menuCommand);
		
		
	}
	
	private Command menuCommand = new Command() {
        public void menuSelected(MenuItem selectedItem) {
        	if(selectedItem == callRegistrationMenu)
        		ui.loadOperatorLayout();
        	else if (selectedItem == dispatcherMenu)
        		ui.loadDispatcherLayout();
        	else if(selectedItem == callSituationMenu)
        		ui.loadSupervisorLayout();
        	else if (selectedItem == confCommandCenterMenu) {
				
			}
        	else if (selectedItem == confDispatcherMenu) {
        		ui.loadDispatcherConfigLayout();
			}
        	else if (selectedItem == confCallReasonMenu) {
				ui.loadCallReasonLayout();
			}
        	
        	else if (selectedItem == confGradeMenu) {
				ui.loadGradeLayout();
			}
        }
    };
}
